<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-row :gutter="20">
        <el-col :span="8"
          ><el-input
            placeholder="请输入内容"
            v-model="roulfrom.query"
            class="input-with-select"
            style="margin-top: 15px"
          >
            <el-button
              slot="append"
              icon="el-icon-search"
            ></el-button> </el-input
        ></el-col>
      </el-row>
      <el-table :data="tableData" border style="width: 100%; margin-top: 15px">
        <el-table-column type="index" label="#"> </el-table-column>
        <el-table-column prop="order_number" label="订单编号"> </el-table-column>
        <el-table-column prop="order_price" label="订单价格"> </el-table-column>
        <el-table-column  label="是否付款">
            <template slot-scope="scope">
                <el-tag type="danger" v-if="scope.row.order_pay==0">未付款</el-tag>
                <el-tag type="danger"  v-if="scope.row.order_pay==1">已付款</el-tag>
            </template>
         </el-table-column>
        <el-table-column prop="is_send" label="是否发货"> </el-table-column>
        <el-table-column prop="create_time" label="下单时间"> 
            <template slot-scope="scope">
              {{scope.row.create_time*1000 | dateFormat}}
            </template>
        </el-table-column>
        <el-table-column label="操作">
            <template slot-scope="scope">
                  <el-button type="primary" icon="el-icon-edit" circle @click="edit(scope.row)"></el-button>
                  <el-button type="success" icon="el-icon-location-outline" circle></el-button>
            </template>
         </el-table-column>
      </el-table>
       <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="roulfrom.pagenum"
      :page-sizes="[5, 10, 11, 12]"
      :page-size="roulfrom.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
    </el-card>
    <el-dialog title="修改地址" :visible.sync="dialogFormVisible">
  <el-form :model="form">
    <el-form-item label="省市区/县" >
      
    </el-form-item>
    <el-form-item label="详细地址" >
       <!-- <el-cascader
    v-model="value"
    :options="options"
    @change="handleChange"></el-cascader> -->
    </el-form-item>
  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="dialogFormVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
  </div>
</el-dialog>
  </div>
</template>

<script>
import {getordersApi} from '@/http/api'
export default {
  data() {
    return {
      tableData: [],
      roulfrom:{
          query:"",
          pagenum:1,
          pagesize:5,
      },
      total:0,
      dialogFormVisible :false,
      form:[],
      options:[]
    };
  },
  created(){
      this.getlist()
  },
  components: {},
  mounted() {},
  methods: {
    handleChange(){

    },
    edit(row){
        this.dialogFormVisible=true
    },
     handleSizeChange(val){
         this.roulfrom.pagesize=val
         this.getlist()
     },
     handleCurrentChange(val){
         this.roulfrom.pagenum=val
          this.getlist()
     },
     async getlist(){
         const res=await getordersApi(this.roulfrom)
         console.log(res);
         this.total=res.total
         this.tableData=res.goods
      }
  },
  computed: {},
  watch: {},
};
</script>

<style scoped lang='less'>
</style>
